//
//  Home_BirthCollectionCell.m
//  HuaRun2
//
//  Created by admin on 17/9/5.
//  Copyright © 2017年 Sunny. All rights reserved.
//

#import "Home_BirthCollectionCell.h"
#import "Home_BirthModel.h"

@interface Home_BirthCollectionCell ()

//名字
@property (nonatomic, strong) UILabel * nameLab;
//
@property (nonatomic, strong) UILabel * nameLab1;

@end
@implementation Home_BirthCollectionCell
#pragma mark - life cycle
- (void)dealloc {
    NSLog(@"%@ dealloc", [self class]);
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self viewInit];
        [self layoutInit];
    }
    return self;
}

- (void)viewInit {
    //    self.contentView.backgroundColor = kRandomColor;
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    [self addSubview:self.nameLab1];
    [self addSubview:self.nameLab];
}
- (void)layoutInit {
    weakself(ws);
    
    [self.nameLab mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(ws.contentView.mas_left).offset(kMargin15);
        make.right.mas_equalTo(ws.contentView.mas_right).offset(-kMargin15);
        make.top.mas_equalTo(ws.contentView).offset(kMargin10);
        make.height.mas_equalTo(20);
    }];
    
    [self.nameLab1 mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(ws.contentView.mas_left).offset(kMargin15);
        make.right.mas_equalTo(ws.contentView.mas_right).offset(-kMargin15);
        make.top.mas_equalTo(ws.nameLab.mas_bottom).offset(0);
        make.height.mas_equalTo(ws.nameLab);
    }];
    
}

- (void)setBirthModel:(Home_BirthModel *)birthModel {
    _birthModel = birthModel;
    _nameLab.text = [NSString stringWithFormat:@"%@ %@ %@",
                       [NSString showSpaceStringWithStr: birthModel.salutation],
                       [NSString showSpaceStringWithStr: birthModel.lastName],
                       [NSString showSpaceStringWithStr: birthModel.firstName]];
    _nameLab1.text = [NSString showSpaceStringWithStr:birthModel.accountName];

}

- (UILabel *)nameLab {
    if (!_nameLab) {
        self.nameLab = [UILabel new];
        _nameLab.textAlignment = NSTextAlignmentLeft;
        _nameLab.font = kGeneralFontSize;
        _nameLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _nameLab.numberOfLines = 1;
    }
    return _nameLab;
}


- (UILabel *)nameLab1 {
    if (!_nameLab1) {
        self.nameLab1 = [UILabel new];
        _nameLab1.textAlignment = NSTextAlignmentLeft;
        _nameLab1.font = kGeneralFontSize;
        _nameLab1.textColor = [UIColor colorWithHex:@"3c3c3c"];
        _nameLab1.numberOfLines = 1;
    }
    return _nameLab1;
}
@end
